set matsize 5000

capture cd "C:\Users\jmarshall\Dropbox\UPE in Nigeria\DoFiles and Data for Merging\Replication file"

use "Afrobarometer_Final.dta", clear

rename year_census year_survey
replace year_survey = 2008 if year_survey==2009

global controls "non_prim_educ_lga i.gender i.religion i.urban_rural i.year_born i.year_survey i.State cohort_state_2-cohort_state_37_post"

global controls2 "i.gender i.religion i.urban_rural i.year_born i.year_survey i.State cohort_state_2-cohort_state_37_post"

log using "Results Log.smcl", replace






**************************************** VARIABLE CREATION **********************************************

*** Remove early cohorts

drop if year_born<1950



*** Define education level variable

quietly {
  g edu = primary_school_inc
  replace edu = 2 if primary_school==1
  replace edu = 3 if secondary_school_inc==1
  replace edu = 4 if secondary_school==1
  replace edu = 5 if college==1
}
label var edu "Education"
label define edu 0 "No education (19.5%)" 1 "Incomplete primary school (5.0%)" 2 "Complete primary school (10.6%)" 3 "Incomplete secondary school (14.5%)" 4 "Complete secondary school (44.5%)" 5 "University (6.0%)"
label values edu edu

rename edu treatment



*** UPE Intensity dummy

g high_intensity = non_prim_educ_lga>=.3333333
label define highlow 0 "Low UPE intensity" 1 "High UPE Intensity"
label values high_intensity highlow



*** Interest in news variable

gen tv_news_scale = 0 if tv_news!=.
replace tv_news_scale = 1 if tv_news_rare==1
replace tv_news_scale = 2 if tv_news==1
replace tv_news_scale = 3 if tv_news_sev==1
replace tv_news_scale = 4 if tv_news_oft==1

gen radio_news_scale = 0 if radio_news!=.
replace radio_news_scale = 1 if radio_news_rare==1
replace radio_news_scale = 2 if radio_news==1
replace radio_news_scale = 3 if radio_news_sev==1
replace radio_news_scale = 4 if radio_news_oft==1

gen newspapers_news_scale = 0 if newspapers_news!=.
replace newspapers_news_scale = 1 if newspapers_news_rare==1
replace newspapers_news_scale = 2 if newspapers_news==1
replace newspapers_news_scale = 3 if newspapers_news_sev==1
replace newspapers_news_scale = 4 if newspapers_news_oft==1

alpha tv_news_scale radio_news_scale newspapers_news_scale, g(newsinterest) std
egen newsinterest_std = std(newsinterest)
drop newsinterest
rename newsinterest_std newsinterest



*** Knowledge of local politicians

alpha name_mp name_lg_off name_fin_min name_vice_pres name_governor, g(pol_know)
egen pol_know_std = std(pol_know)
drop pol_know
rename pol_know_std pol_know



*** Political evaluations and preferences

alpha handles_economy handles_health handles_education handles_employment handles_inflation  handles_water  handles_inequality, g(govt_handles)
alpha performance_president performance_mp performance_LG_councilor, g(govt_performance)
alpha trust_president trust_national_assembly trust_INEC trust_LG_council trust_ruling_pary , g(trust_govt)
alpha corruption_president corruption_MP corruption_LG_councilors , g(corrupt_govt)



*** Creating state and LGA trends

capture quietly {
  encode(State), g(State2)
  foreach s of numlist 2/37 {
    g cohort_state_`s' = 0
	replace cohort_state_`s' = year_born if State2==`s'
  }
  foreach s of numlist 2/37 {
	g cohort_state_`s'_post = cohort_state_`s' * post
  }
  drop State2
}

capture quietly {
  encode LGA, g(lga)
  foreach l of numlist 2/582 {
    g cohort_lga_`l' = 0
	replace cohort_lga_`l' = year_born if lga==`l'
  }
  foreach l of numlist 2/582 {
	g cohort_lga_`l'_post = cohort_lga_`l' * post
  }
  drop lga
}






**************************************** DESCRIPTIVE STATISTICS **********************************************

*** Figure 2: Number of public and private primary schools founded since independence (source: Nigerian Primary School Census 2008)
preserve
use "School Founding Years.dta", clear
twoway (scatter agg_schools_founded_pub founded if sector=="Public" & founded> 1960, mcolor(black)) (scatter agg_schools_founded_priv founded if sector=="Private"& founded> 1960, mcolor(black) msymbol(circle_hollow)) , xline(1976, lcolor(gray) lpattern(dash)) ylabel(, nogrid) subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) legend(nobox region(fcolor(white) margin(zero) lcolor(white))) xtitle("Year founded")
restore



*** Figure 3: UPE intensity distribution across LGAs and by gender (source: HNLSS)
twoway (kdensity non_prim_educ_lga if gender=="male", lcolor(black)) (kdensity non_prim_educ_lga if gender=="female", lcolor(black) lpattern(dash)), ylab(, nogrid) ytitle("Density") xtitle("Intensity") subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) legend(nobox region(fcolor(white) margin(zero) lcolor(white)) lab(1 "Male") lab(2 "Female")) 



*** Table A1: Summary statistics
g sample = 0
quietly foreach y of varlist discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
  xi: reg `y' treatment $controls
  replace sample = 1 if e(sample)==1
}
xi: summ discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active ///
  nigeria_united rel_group_assoc_active ethnic_national violence_not_ok contact_comm_prob contact_priv_prob contact_religious_leader contact_traditional_ruler ///
  govt_handles govt_performance trust_govt corrupt_govt inequality_improvement close_PDP ///
  treatment primary_school_inc primary_school secondary_school_inc secondary_school college post non_prim_educ_lga post_non_prim_educ_lga ///
  i.gender i.religion i.urban_rural year_born year_survey rel_fragm_LGA rel_tension maj_rel tribe_main if sample==1
drop sample



*** Check turnout reporting matches actual turnout
sum voted
tab year_survey if voted!=.
di (3102 * 52.26 + 2193 * 69.08 + 2211 * 69.08 + 2238 * 57.49 + 2298 * 53.68) / 12042



*** Table A2: Outcome pairwise correlation matrix
pwcorr discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active



***Figure A2: Trends in education level by UPE intensity (sources: Afrobarometer and HNLSS)
bysort year_born : egen mean_pri_inc_low = mean(primary_school_inc) if non_prim_educ_lga<.33
bysort year_born : egen mean_pri_com_low = mean(primary_school) if non_prim_educ_lga<.33
bysort year_born : egen mean_pri_inc_high = mean(primary_school_inc) if non_prim_educ_lga>.33
bysort year_born : egen mean_pri_com_high = mean(primary_school) if non_prim_educ_lga>.33
bysort year_born : egen mean_sec_inc_low = mean(secondary_school_inc) if non_prim_educ_lga<.33
bysort year_born : egen mean_sec_com_low = mean(secondary_school) if non_prim_educ_lga<.33
bysort year_born : egen mean_sec_inc_high = mean(secondary_school_inc) if non_prim_educ_lga>.33
bysort year_born : egen mean_sec_com_high = mean(secondary_school) if non_prim_educ_lga>.33
bysort year_born : g cohort_weight = _N

twoway (scatter mean_pri_inc_low year_born if year_born>=1950 [w=cohort_weight], color(gs9) msize(vsmall)) ///
  (scatter mean_pri_inc_high year_born if year_born>=1950 [w=cohort_weight], color(black) msize(vsmall)) ///
  (lpoly primary_school_inc year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga<.33, lcolor(gs9) clwidth(medthick)) ///
  (lpoly primary_school_inc year_born if year_born>=1970 & non_prim_educ_lga<.33, lcolor(gs9) clwidth(medthick)) ///
  (lpoly primary_school_inc year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga>.33, lcolor(black) clwidth(medthick)) ///
  (lpoly primary_school_inc year_born if year_born>=1970 & non_prim_educ_lga>.33, lcolor(black) clwidth(medthick)), ///
  subtitle(, color(gs9) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) xtitle("Year of birth") legend(nobox region(fcolor(white) margin(zero) lcolor(white)) ///
  lab(3 "Below-median intensity") lab(6 "Above-median intensity") order(3 6)) ylab(, nogrid) ytitle("Proportion") title("Incomplete primary school", size(mediumsmall) color(black)) xline(1970, lcolor(black) lpattern(dash))
graph save Graph "g1.gph", replace

twoway (scatter mean_pri_com_low year_born if year_born>=1950 [w=cohort_weight], color(gs9) msize(vsmall)) ///
  (scatter mean_pri_com_high year_born if year_born>=1950 [w=cohort_weight], color(black) msize(vsmall)) ///
  (lpoly primary_school year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga<.33, lcolor(gs9) clwidth(medthick)) ///
  (lpoly primary_school year_born if year_born>=1970 & non_prim_educ_lga<.33, lcolor(gs9) clwidth(medthick)) ///
  (lpoly primary_school year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga>.33, lcolor(black) clwidth(medthick)) ///
  (lpoly primary_school year_born if year_born>=1970 & non_prim_educ_lga>.33, lcolor(black) clwidth(medthick)), ///
  subtitle(, color(gs9) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) xtitle("Year of birth") legend(nobox region(fcolor(white) margin(zero) lcolor(white)) ///
  lab(3 "Below-median intensity") lab(6 "Above-median intensity") order(3 6)) ylab(, nogrid) ytitle("Proportion") title("Complete primary school", size(mediumsmall) color(black)) xline(1970, lcolor(black) lpattern(dash))
graph save Graph "g2.gph", replace

twoway (scatter mean_sec_inc_low year_born if year_born>=1950 [w=cohort_weight], color(gs9) msize(vsmall)) ///
  (scatter mean_sec_inc_high year_born if year_born>=1950 [w=cohort_weight], color(black) msize(vsmall)) ///
  (lpoly secondary_school_inc year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga<.33, lcolor(gs9) clwidth(medthick)) ///
  (lpoly secondary_school_inc year_born if year_born>=1970 & non_prim_educ_lga<.33, lcolor(gs9) clwidth(medthick)) ///
  (lpoly secondary_school_inc year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga>.33, lcolor(black) clwidth(medthick)) ///
  (lpoly secondary_school_inc year_born if year_born>=1970 & non_prim_educ_lga>.33, lcolor(black) clwidth(medthick)), ///
  subtitle(, color(gs9) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) xtitle("Year of birth") legend(nobox region(fcolor(white) margin(zero) lcolor(white)) ///
  lab(3 "Below-median intensity") lab(6 "Above-median intensity") order(3 6)) ylab(, nogrid) ytitle("Proportion") title("Incomplete secondary school", size(mediumsmall) color(black)) xline(1970, lcolor(black) lpattern(dash))
graph save Graph "g3.gph", replace

twoway (scatter mean_sec_com_low year_born if year_born>=1950 [w=cohort_weight], color(gs9) msize(vsmall)) ///
  (scatter mean_sec_com_high year_born if year_born>=1950 [w=cohort_weight], color(black) msize(vsmall)) ///
  (lpoly secondary_school year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga<.33, lcolor(gs9) clwidth(medthick)) ///
  (lpoly secondary_school year_born if year_born>=1970 & non_prim_educ_lga<.33, lcolor(gs9) clwidth(medthick)) ///
  (lpoly secondary_school year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga>.33, lcolor(black) clwidth(medthick)) ///
  (lpoly secondary_school year_born if year_born>=1970 & non_prim_educ_lga>.33, lcolor(black) clwidth(medthick)), ///
  subtitle(, color(gs9) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) xtitle("Year of birth") legend(nobox region(fcolor(white) margin(zero) lcolor(white)) ///
  lab(3 "Below-median intensity") lab(6 "Above-median intensity") order(3 6)) ylab(, nogrid) ytitle("Proportion") title("Complete secondary school", size(mediumsmall) color(black)) xline(1970, lcolor(black) lpattern(dash))
graph save Graph "g4.gph", replace

grc1leg "g1" "g2" "g3" "g4", rows(2) cols(2) subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))

erase "g1.gph" 
erase "g2.gph" 
erase "g3.gph" 
erase "g4.gph" 



*** Figure 4: Trends in education level, voting, political knowledge and community meeting attendance, by UPE intensity (sources: Afrobarometer and HNLSS)
bysort year_born : egen mean_edu_low = mean(treatment) if non_prim_educ_lga<.33
bysort year_born : egen mean_edu_high = mean(treatment) if non_prim_educ_lga>.33
bysort year_born : egen mean_pol_know_low = mean(pol_know) if non_prim_educ_lga<=.33
bysort year_born : egen mean_pol_know_high = mean(pol_know) if non_prim_educ_lga>.33
bysort year_born : egen mean_voted_low = mean(voted) if non_prim_educ_lga<=.33
bysort year_born : egen mean_voted_high = mean(voted) if non_prim_educ_lga>.33
bysort year_born : egen mean_att_community_meeting_low = mean(att_community_meeting) if non_prim_educ_lga<=.33
bysort year_born : egen mean_att_community_meeting_high = mean(att_community_meeting) if non_prim_educ_lga>.33

twoway (scatter mean_edu_low year_born if year_born>=1950 [w=cohort_weight], color(gs9) msize(tiny)) ///
  (scatter mean_edu_high year_born if year_born>=1950 [w=cohort_weight], color(black) msize(tiny)) ///
  (lpoly treatment year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga<.33, bwidth(2) lcolor(gs9) clwidth(medthick)) ///
  (lpoly treatment year_born if year_born>=1970 & non_prim_educ_lga<.33, bwidth(2) lcolor(gs9) clwidth(medthick)) ///
  (lpoly treatment year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga>.33, bwidth(2) lcolor(black) clwidth(medthick)) ///
  (lpoly treatment year_born if year_born>=1970 & non_prim_educ_lga>.33, bwidth(2) lcolor(black) clwidth(medthick)), ///
  subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) xtitle("Year of birth") legend(nobox region(fcolor(white) margin(zero) lcolor(white)) ///
  lab(3 "Below-median intensity") lab(6 "Above-median intensity") order(3 6)) ylab(, nogrid) ytitle("Scale") title("Education", color(black)) xline(1970, lcolor(black) lpattern(dash)) xlabel(1950(10)1995) 
graph save Graph "g1.gph", replace

twoway (scatter mean_pol_know_low year_born if year_born>=1950 [w=cohort_weight], color(gs9) msize(tiny)) ///
  (scatter mean_pol_know_high year_born if year_born>=1950 [w=cohort_weight], color(black) msize(tiny)) ///
  (lpoly pol_know year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga<.33, bwidth(2) lcolor(gs9) clwidth(medthick)) ///
  (lpoly pol_know year_born if year_born>=1970 & non_prim_educ_lga<.33, bwidth(2) lcolor(gs9) clwidth(medthick)) ///
  (lpoly pol_know year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga>.33, bwidth(2) lcolor(black) clwidth(medthick)) ///
  (lpoly pol_know year_born if year_born>=1970 & non_prim_educ_lga>.33, bwidth(2) lcolor(black) clwidth(medthick)), ///
  subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) xtitle("Year of birth") legend(nobox region(fcolor(white) margin(zero) lcolor(white)) ///
  lab(3 "Below-median intensity") lab(6 "Above-median intensity") order(3 6)) ylab(, nogrid) ytitle("Scale") title("Political knowledge scale", color(black)) xline(1970, lcolor(black) lpattern(dash)) xlabel(1950(10)1995)
graph save Graph "g2.gph", replace

twoway (scatter mean_voted_low year_born if year_born>=1950 [w=cohort_weight], color(gs9) msize(tiny)) ///
  (scatter mean_voted_high year_born if year_born>=1950 [w=cohort_weight], color(black) msize(tiny)) ///
  (lpoly voted year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga<.33, bwidth(2) lcolor(gs9) clwidth(medthick)) ///
  (lpoly voted year_born if year_born>=1970 & non_prim_educ_lga<.33, bwidth(2) lcolor(gs9) clwidth(medthick)) ///
  (lpoly voted year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga>.33, bwidth(2) lcolor(black) clwidth(medthick)) ///
  (lpoly voted year_born if year_born>=1970 & non_prim_educ_lga>.33, bwidth(2) lcolor(black) clwidth(medthick)), ///
  subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) xtitle("Year of birth") legend(nobox region(fcolor(white) margin(zero) lcolor(white)) ///
  lab(3 "Below-median intensity") lab(6 "Above-median intensity") order(3 6)) ylab(, nogrid) ytitle("Proportion") title("Voted", color(black)) xline(1970, lcolor(black) lpattern(dash)) xlabel(1950(10)1995) 
graph save Graph "g3.gph", replace

twoway (scatter mean_att_community_meeting_low year_born if year_born>=1950 [w=cohort_weight], color(gs9) msize(tiny)) ///
  (scatter mean_att_community_meeting_high year_born if year_born>=1950 [w=cohort_weight], color(black) msize(tiny)) ///
  (lpoly att_community_meeting year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga<.33, bwidth(2) lcolor(gs9) clwidth(medthick)) ///
  (lpoly att_community_meeting year_born if year_born>=1970 & non_prim_educ_lga<.33, bwidth(2) lcolor(gs9) clwidth(medthick)) ///
  (lpoly att_community_meeting year_born if year_born>=1950 & year_born<1970 & non_prim_educ_lga>.33, bwidth(2) lcolor(black) clwidth(medthick)) ///
  (lpoly att_community_meeting year_born if year_born>=1970 & non_prim_educ_lga>.33, bwidth(2) lcolor(black) clwidth(medthick)), ///
  subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) xtitle("Year of birth") legend(nobox region(fcolor(white) margin(zero) lcolor(white)) ///
  lab(3 "Below-median intensity") lab(6 "Above-median intensity") order(3 6)) ylab(, nogrid) ytitle("Proportion") title("Attend community meeting", color(black)) xline(1970, lcolor(black) lpattern(dash)) xlabel(1950(10)1995) 
graph save Graph "g4.gph", replace

grc1leg "g1" "g3" "g2" "g4", rows(2) cols(2) subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))

erase "g1.gph" 
erase "g2.gph" 
erase "g3.gph" 
erase "g4.gph" 






********************************************* FIRST STAGE ********************************************

quietly {

*** First Stage

eststo clear
eststo, title("main"): xi: areg treatment post_non_prim_educ_lga   $controls,  cluster(State) a(year_born)
test post_non_prim_educ_lga
estadd scalar Fstat = `r(F)'
sum treatment if e(sample)==1
estadd scalar Outcome_Mean=`r(mean)'
estadd scalar Outcome_SD=`r(sd)'	
sum post_non_prim_educ_lga if e(sample)==1
estadd scalar Treatment_Mean=`r(mean)'
estadd scalar Treatment_SD=`r(sd)'	



*** First-stage placebo: 1965 reform instead

eststo, title("placebo 1965"): xi: reg treatment placebo_non_prim_educ_lga   $controls,  cluster(State)
test placebo_non_prim_educ_lga
estadd scalar Fstat = `r(F)'
sum treatment if e(sample)==1
estadd scalar Outcome_Mean=`r(mean)'
estadd scalar Outcome_SD=`r(sd)'	
sum placebo_non_prim_educ_lga if e(sample)==1
estadd scalar Treatment_Mean=`r(mean)'
estadd scalar Treatment_SD=`r(sd)'	



*** First-stage placebo: 1960 reform instead

capture g placebo2 = year_born>=1955 if year_born<1965
capture g placebo2_non_prim_educ_lga = placebo2 * non_prim_educ_lga

eststo, title("placebo 1960"): xi: reg treatment placebo2_non_prim_educ_lga   $controls,  cluster(State)
test placebo2_non_prim_educ_lga
estadd scalar Fstat = `r(F)'
sum treatment if e(sample)==1
estadd scalar Outcome_Mean=`r(mean)'
estadd scalar Outcome_SD=`r(sd)'	
sum placebo2_non_prim_educ_lga if e(sample)==1
estadd scalar Treatment_Mean=`r(mean)'
estadd scalar Treatment_SD=`r(sd)'	



*** First Stage by education level

foreach y of varlist primary_school_inc primary_school secondary_school_inc secondary_school {
  eststo, title("`y'") : xi: reg `y' post_non_prim_educ_lga   $controls,  cluster(State)
  test post_non_prim_educ_lga
  estadd scalar Fstat = `r(F)'
  sum `y' if e(sample)==1
  estadd scalar Outcome_Mean=`r(mean)'
  estadd scalar Outcome_SD=`r(sd)'	
  sum post_non_prim_educ_lga if e(sample)==1
  estadd scalar Treatment_Mean=`r(mean)'
  estadd scalar Treatment_SD=`r(sd)'	
}

}



*** Table 1: Effect of UPE intensity on education (first stage)

estout, cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD Treatment_Mean Treatment_SD Fstat, fmt(0 2 2 2 2 1) ///
  labels("Observations" "Outcome mean" "Outcome std. dev." "Instrument mean" "Instrument std. dev." "First stage $ F$ statistic")) ///
  starlevels(* .1 ** .05 *** .01) keep(non_prim_educ_lga post_non_prim_educ_lga placebo_non_prim_educ_lga placebo2_non_prim_educ_lga) label ///
  varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" placebo_non_prim_educ_lga "1965 Placebo $\times$ Intensity" placebo2_non_prim_educ_lga "1960 Placebo $\times$ Intensity" non_prim_educ_lga "Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD Treatment_Mean Treatment_SD Fstat, fmt(0 2 2 2 2 1) ///
  labels("Observations" "Outcome mean" "Outcome std. dev." "Instrument mean" "Instrument std. dev." "First stage $ F$ statistic")) ///
  starlevels(* .1 ** .05 *** .01) keep(non_prim_educ_lga post_non_prim_educ_lga placebo_non_prim_educ_lga placebo2_non_prim_educ_lga) label ///
  varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" placebo_non_prim_educ_lga "1965 Placebo $\times$ Intensity" placebo2_non_prim_educ_lga "1960 Placebo $\times$ Intensity" non_prim_educ_lga "Intensity")






**************************************** AVERAGE EFFECTS **********************************************

*** Table 2: Effect of UPE intensity and education on civic and political engagement

*Interest in Politics
eststo clear 
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know {
    eststo, title("`y'"): xi: reg `y' treatment $controls2,  cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga   $controls if e(sample)==1, cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")

* Basic Political Participation
eststo clear 
quietly {
  foreach y of varlist registered_voter voted {
    eststo, title("`y'"): xi: reg `y' treatment $controls2,  cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga   $controls if e(sample)==1, cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")

* Rare Political Participation
eststo clear 
quietly {
  foreach y of varlist att_demonstration contact_LG_councilor contact_MP {
    eststo, title("`y'"): xi: reg `y' treatment $controls2,  cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga   $controls if e(sample)==1, cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")

* Community participation
eststo clear 
quietly {
  foreach y of varlist att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: reg `y' treatment $controls2,  cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga   $controls if e(sample)==1, cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")



*** Calculate aggregate effects for main variables
preserve
use "Share_primary_education_by_1976.dta", replace
merge m:m State LGA using "Census_Population_2006.dta"
drop _merge
merge m:1 State LGA using "Cohorts_LGA_hnlss.dta"
egen pop2006 = sum( voting_age_m +  voting_age_f)
g discuss_LGA = .095 * ( (1 - prim_educ_lga_10_male) * voting_age_treatment_m + (1 - prim_educ_lga_10_female) * voting_age_treatment_f ) / pop2006
egen discuss_agg = sum(discuss_LGA)
g voted_LGA = .110 * ( (1 - prim_educ_lga_10_male) * voting_age_treatment_m + (1 - prim_educ_lga_10_female) * voting_age_treatment_f ) / pop2006
egen voted_agg = sum(voted_LGA)
g comm_LGA = .125 * ( (1 - prim_educ_lga_10_male) * voting_age_treatment_m + (1 - prim_educ_lga_10_female) * voting_age_treatment_f ) / pop2006
egen comm_agg = sum(comm_LGA)
summ discuss_agg voted_agg comm_agg
restore










**************************************** ROBUSTNESS CHECKS **********************************************

*** Table 3: Robustness checks
*** Table A3: Robustness checks|all other outcomes

* Panel A: Born before 1976 only (reduced form)
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga     $controls if year_born<1976 & treatment!=., cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Placebo $\times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Placebo $\times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga     $controls if year_born<1976 & treatment!=., cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Placebo $\times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Placebo $\times$ Intensity")



* Panel B: Without LGAs with a 2006 population exceeding 500,000 (2SLS)
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls if population2006<500000, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls if population2006<500000, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")



* Panel C: Correlation with intensity, born after 1969 only
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: reg `y'   $controls if post==1 & treatment!=., cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(non_prim_educ_lga) label varlabels(non_prim_educ_lga "Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(non_prim_educ_lga) label varlabels(non_prim_educ_lga "Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: reg `y'   $controls if post==1 & treatment!=., cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(non_prim_educ_lga) label varlabels(non_prim_educ_lga "Intensity" treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(non_prim_educ_lga) label varlabels(non_prim_educ_lga "Intensity" treatment "Education")



* Panel D: LGA fixed effects and LGA-specific cohort trends (2SLS)
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)     $controls i.LGA cohort_lga_2-cohort_lga_582_post, cluster(State) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)     $controls i.LGA cohort_lga_2-cohort_lga_582_post, cluster(State) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education")



* Panel E: State fixed effects and no cohort trends (2SLS)
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   non_prim_educ_lga i.gender i.religion i.urban_rural i.year_born i.year_survey i.State, cluster(State) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   non_prim_educ_lga i.gender i.religion i.urban_rural i.year_born i.year_survey i.State, cluster(State) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")



* Panel F: 1965 placebo reform, born before 1970 only (reduced form)
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: reg `y' placebo_non_prim_educ_lga     $controls if post==0 & treatment!=., cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(placebo_non_prim_educ_lga) label varlabels(placebo_non_prim_educ_lga "Placebo $\times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(placebo_non_prim_educ_lga) label varlabels(placebo_non_prim_educ_lga "Placebo $\times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: reg `y' placebo_non_prim_educ_lga     $controls if post==0 & treatment!=., cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(placebo_non_prim_educ_lga) label varlabels(placebo_non_prim_educ_lga "Placebo $\times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(placebo_non_prim_educ_lga) label varlabels(placebo_non_prim_educ_lga "Placebo $\times$ Intensity")



* Panel G: 1960 placebo reform, born before 1965 only (reduced form)
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: reg `y' placebo2_non_prim_educ_lga     $controls if year_born<1965 & treatment!=., cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(placebo2_non_prim_educ_lga) label varlabels(placebo2_non_prim_educ_lga "Placebo $\times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(placebo2_non_prim_educ_lga) label varlabels(placebo2_non_prim_educ_lga "Placebo $\times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: reg `y' placebo2_non_prim_educ_lga     $controls if year_born<1965 & treatment!=., cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(placebo2_non_prim_educ_lga) label varlabels(placebo2_non_prim_educ_lga "Placebo $\times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(placebo2_non_prim_educ_lga) label varlabels(placebo2_non_prim_educ_lga "Placebo $\times$ Intensity")



* Panel H: State-post reform fixed effects (2SLS)
capture egen state_post = group(State post)

eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls i.state_post, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls i.state_post, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")



* Panel I: Controlling for pre-treatment covariates by UPE eligibility (2SLS)
g post_christian_LGA = post * christian_LGA
g post_muslim_LGA = post * muslim_LGA
g post_population1963 = post * population1963

eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   post_christian_LGA post_muslim_LGA post_population1963 population1963 muslim_LGA christian_LGA $controls, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   post_christian_LGA post_muslim_LGA post_population1963 population1963 muslim_LGA christian_LGA $controls, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")



* Panel J: Allowing students to be partially affected by UPE (2SLS)

preserve

replace post = 5/6 if year_born==1969
replace post = 4/6 if year_born==1968
replace post = 3/6 if year_born==1967
replace post = 2/6 if year_born==1966
replace post = 1/6 if year_born==1965
replace post_non_prim_educ_lga = post * non_prim_educ_lga

eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)     non_prim_educ_lga i.gender i.religion i.urban_rural i.year_born i.year_survey i.State, cluster(State) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)     non_prim_educ_lga i.gender i.religion i.urban_rural i.year_born i.year_survey i.State, cluster(State) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education")

restore



*** Table A4: Alternative measures of intensity (2SLS estimates)

* Panel A: Intensity defined by cohort born between 1960 and 1964eststo clear
eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga_5)     non_prim_educ_lga_5 i.gender i.religion i.urban_rural i.year_born i.year_survey i.State, cluster(State) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")



* Panel B: Intensity defined by incomplete primary schooling
eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_sch_lga)     non_prim_sch_lga i.gender i.religion i.urban_rural i.year_born i.year_survey i.State, cluster(State) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations" "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")



*** Table A5: Removing partially treated cohorts

* Panel A
eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga     $controls if year_born>=1970 & treatment!=. | year_born<=1964 & treatment!=., cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) mlabels("OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS") varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity")



* Panel B
eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)     $controls if year_born>=1970 | year_born<=1964, cluster(State) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) label varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education")



*** Unreported check cited in the paper: 1976 State clustering

* Reduced form
eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga     $controls if treatment!=., cluster(State1976)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) mlabels("OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS" "OLS") varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity")



* IV
eststo clear 
quietly {
  foreach y of varlist discuss_politics_often pol_know newsinterest registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls, cluster(State1976) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education")



*** Table A10: Effect of UPE intensity and education on incumbent performance evaluations and closeness to ruling party
eststo clear 
quietly {
  foreach y of varlist govt_handles govt_performance trust_govt corrupt_govt inequality_improvement close_PDP {
    eststo, title("`y'"): xi: reg `y' treatment $controls2,  cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga   $controls if e(sample)==1, cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")






********************************************** Heterogeneous Effects **********************************************

*** Table 4: Differences in UPE intensity's effect by religion and ethnic group
*** Table A6: Differences in UPE intensity's effect by religion and ethnic group 1-all other outcomes
*** Table A7: Differences in UPE intensity's effect by religion and ethnic group 2-all other outcomes

* Panel A
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if rel_fragm_h==1 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if rel_fragm_h==0 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if rel_fragm_h==1 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if rel_fragm_h==0 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")



* Panel B
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if rel_tension>=0.1221123 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if rel_tension<0.1221123 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if rel_tension>=0.1221123 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if rel_tension<0.1221123 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")



* Panel C
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if maj_rel==0 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if maj_rel==1 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if maj_rel==0 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if maj_rel==1 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")



* Panel D
eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if tribe_main==0 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist pol_know voted att_community_meeting {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if tribe_main==1 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if tribe_main==0 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest registered_voter att_demonstration contact_LG_councilor contact_MP member_assoc_active {
    eststo, title("`y'"): xi: areg `y' post_non_prim_educ_lga    $controls if tribe_main==1 & treatment!=., cluster(State) a(year_born)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")



*** Table 5: Effect of UPE intensity and education on support for violence and ethnic, national and religious identification
eststo clear 
quietly {
  foreach y of varlist violence_not_ok rel_group_assoc_active ethnic_national nigeria_united {
    eststo, title("`y'"): xi: reg `y' treatment $controls2,  cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga   $controls if e(sample)==1, cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")



*** Table A8: Effect of education on contacting politicians and local leaders
eststo clear 
quietly {
  foreach y of varlist contact_comm_prob contact_priv_prob contact_religious_leader contact_traditional_ruler {
    eststo, title("`y'"): xi: reg `y' treatment $controls2,  cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga   $controls if e(sample)==1, cluster(State)
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)   $controls, cluster(State) first
	sum `y' if e(sample)
    estadd scalar Outcome_Mean=`r(mean)'
    estadd scalar Outcome_SD=`r(sd)'	
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N Outcome_Mean Outcome_SD F_stat, fmt(0 2 2 1) labels("Observations" "Outcome mean" "Outcome std. dev." "First stage $ F$ statistic")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga treatment) label varlabels(post_non_prim_educ_lga "Post-UPE $\times$ Intensity" treatment "Education")



*** Unreported check cited in the paper: heterogeneity by gender
eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga    $controls if gender=="male", cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: reg `y' post_non_prim_educ_lga    $controls if gender=="female", cluster(State)
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(post_non_prim_educ_lga) label varlabels(post_non_prim_educ_lga "Post-UPE $ \times$ Intensity")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)    $controls if gender=="male", cluster(State) first
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education") label
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education")

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know registered_voter voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment = post_non_prim_educ_lga)    $controls if gender=="female", cluster(State) first
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education") label
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N, fmt(0) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment) mlabels("2SLS" "2SLS" "2SLS" "2SLS") varlabels(treatment "Education")



*** Table A9: Interaction of education with share of schooling under democracy (2SLS estimates)
g demo = year_born<=1977 & year_born>=1967 | year_born>=1987 | year_born<=1961 & year_born>=1948
replace demo = 1/6 if year_born==1967 | year_born==1977 | year_born==1987 | year_born==1948 | year_born==1961
replace demo = 2/6 if year_born==1968 | year_born==1976 | year_born==1988 | year_born==1949 | year_born==1960
replace demo = 3/6 if year_born==1969 | year_born==1975 | year_born==1989 | year_born==1950 | year_born==1959
replace demo = 4/6 if year_born==1970 | year_born==1974 | year_born==1990 | year_born==1951 | year_born==1958
replace demo = 5/6 if year_born==1971 | year_born==1973 | year_born==1991 | year_born==1952 | year_born==1957

g demo_post_non_prim_educ_lga = demo*post_non_prim_educ_lga
g treatment_demo = demo*treatment

eststo clear
quietly {
  foreach y of varlist discuss_politics_often newsinterest pol_know voted att_demonstration contact_LG_councilor contact_MP att_community_meeting member_assoc_active {
    eststo, title("`y'"): xi: ivreg2 `y' (treatment treatment_demo = post_non_prim_educ_lga demo_post_non_prim_educ_lga)     demo $controls, cluster(State) first
	matrix A = e(first) 
    estadd scalar F_stat=A[3,1]
  }
}
estout, cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment treatment_demo) label varlabels(treatment "Education" treatment_demo "Primary school $ \times democracy at school")
estout, style(tex) cells(b(star fmt(3)) se(par)) stats(N F_stat, fmt(0 1) labels("Observations")) starlevels(* .1 ** .05 *** .01) keep(treatment treatment_demo) varlabels(treatment "Education" treatment_demo "Primary school $ \times democracy at school")






log close
